from urllib import request
import re

# 本地文件路径
req = request.urlopen(r'file:///D:\python.learn\pythonProject2\爬\爬虫实践课\day03/text.html')
html = req.read().decode('utf-8')
# 正则表达式匹配
pattern = re.findall(r'<div class="movie-item-info">.*?<a title=".*?">(.*?)</a>.*?<p class="star">(.*?)</p>.*?</div>', html, re.S)

for item in pattern:
    print(f"电影名：{item[0]}  {item[1].strip()}")
